
{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
 <style>
		@media only screen and (max-width: 760px),(min-device-width: 768px) and (max-device-width:1024px)  {
		table, thead, tbody, th, td, tr { 
			display: block; 
		}
		thead tr { 
			position: absolute;
			top: -9999px;
			left: -9999px;
		}
		td { 
			border: none;
			border-bottom: 1px solid #eee; 
			position: relative;
			padding-left:44% !important; 
			padding-top:10px ;
		}
	    #mytable tr{ margin-bottom:20px;}
		td:before { 
			position: absolute;
			top:10px;
			left:8px;
			width: 45%; 
			padding-right:10px;
			white-space: nowrap;
		}
		    td:nth-of-type(1):before { content: "学校部门名称"; }
			td:nth-of-type(2):before { content: "成员"; }
			td:nth-of-type(3):before { content: "操作"; }
        }
		
	</style>
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
                <div class="box-header with-border">
                    <span class="fa fa-pencil" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">学校部门列表</p>
                    <a href="index.php?a=department.departmentadd" class="btn btn-primary btn-sm" style="float:right; color:#fff;"> 新 增 </a>
                </div>
                <div class="box-body">
                  <table class="table table-bordered table-striped"  id="mytable">
                                <thead>
                                    <tr style="background-color:#fcba4b ">
                                        <td width="20%">学校部门名称</td>
                                        <td>成员</td>
                                        <td width="140">操作</td>
                                    </tr>	
                                </thead>

                                <tbody>
                                {%foreach from=$department_lists key=key item=value%}	
                                    <tr>
                                        <td>{%$value.department_name%}</td>

                                        <td>
										{%foreach from=$value.staff_name key=k item=v%}
											{%$v%} 
										{%/foreach%}
										</td>
                                        <td>
                                        	  <a href="index.php?a=department.departmentUpdate&department_id={%$value.department_id%}" class="btn btn-warning btn-sm" title="修改名称"> <i class="fa fa-edit (alias)"></i> </a>
                                              
											<a href="index.php?a=department.staffadd&department_id={%$value.department_id%}" class="btn btn-success btn-sm" title="添加成员"> <i class="fa fa-user" ></i> </a>
                    						  <a	href="index.php?a=department.departmentdel&department_id={%$value.department_id%}" title="删除" class="btn btn-danger btn-sm" onclick="if(confirm('警告！确认删除信息?')==false)return false;"> <i class="fa fa-trash"></i> </a>
                                        </td>
                                    </tr>	
                                {%/foreach%}     
                                	
                            </tbody>
                        </table>
						<div class="box-footer">
						{%$page%}
						</div>
				</div><!--box-body -->
           </div><!--box box-default box-solid-->
        </section>   
      </div><!--row-->
    </section>
 </div>
<!--弹出框--> 
<form  method="post" action="" >
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">选择部门成员</h4>
          </div>
          <div class="modal-body">
			{%foreach from=$staff_lists key=key item=value%}	
                <label class="choice"><input type="checkbox" name="staff_id[]" value="{%$value.staff_id%}"
				{%foreach from=$department_lists key=ke item=va%}
				  {%foreach from=$va key=k item=v%}
				     {%if $k==$value.sfaff_id%}
							checked="checked"
					  {%/if%}
				  {%/foreach%}
				{%/foreach%}
				>{%$value.staff_name%}</label>
            {%/foreach%}	
          </div>
          <div class="modal-footer">
			 <input type="hidden" name="department_id" value="" id ="aa">
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            <button type="submit" class="btn btn-primary">保存</button>
          </div>
        </div>
      </div>
    </div>
	
</form>
 <!-- Modal -->
 
{%include file="index.footer.tpl.php"%}
<script>
function shows(a){

	$("#aa").val(a);
	}

</script>

